package com.tm.chargecar.service.impl;

import com.tm.chargecar.dto.ElectronicCardUserDto;
import com.tm.chargecar.entity.ShopEntity;
import com.tm.chargecar.mapper.ShopMapper;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.ShopService;
import com.tm.chargecar.utils.PageUtil;
import com.tm.chargecar.vo.ShopVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wangSang
 * @create 2022-08-28 17:29
 */
@Service
public class ShopServiceImpl implements ShopService {

    @Autowired
    private ShopMapper shopMapper;

    @Override
    public Result queryShop(ShopVo shopVo) {
        PageUtil pageUtil=new PageUtil();
        //查询总条数
        Long total=shopMapper.total(shopVo);
        //把总条数放到分页工具包
        pageUtil.setTotalCount(total);
        //根据条件查询数据
        List<ShopEntity> list=shopMapper.data(shopVo);
        pageUtil.setData(list);

        return Result.SUCCESS(pageUtil);
    }
}
